Add DatastoreMigration CR awareness to operator controllers#4577
Merged
caseydavenport merged 6 commits intotigera:masterfrom Mar 26, 2026
Merged
Add DatastoreMigration CR awareness to operator controllers#4577caseydavenport merged 6 commits intotigera:masterfrom
caseydavenport merged 6 commits intotigera:masterfrom
Conversation
4ce7270 to
51acfe6
Compare
Wire up the operator to read DatastoreMigration CRs and react to migration phase changes: - Defer APIServer reconciliation during Migrating phase to avoid fighting over the APIService resource - Trigger operator restart on Converged phase to switch to v3 CRD mode - Create/delete dynamic migration RBAC for kube-controllers based on whether a DatastoreMigration CR exists - Check DatastoreMigration CR at startup to handle operator restarts during or after migration
51acfe6 to
09bb287
Compare
- Return errors from GetPhase/Exists so callers can distinguish transient failures from "no migration CR exists" - Accept context.Context in WaitForWatchAndAdd for clean shutdown - Fix setAPIGroupEnvVar to handle multi-container pods correctly - Move DatastoreMigrationGVR into datastoremigration package and have version.go call GetPhase directly, eliminating duplicated phase-checking logic - Derive GVK from GVR in WaitForWatchAndAdd instead of inline literals - Add comment noting migration RBAC is time-bounded
rene-dekker
reviewed
Mar 25, 2026
Replace dynamic client with a controller-runtime cached client for DatastoreMigration CR lookups. Add minimal stub types registered with the scheme so the manager's cache can watch these objects, and gate queries on watch readiness to avoid uncached API server requests.
The UseV3CRDS check runs before the manager cache is started, so it needs a direct dynamic client query rather than the cached client.
rene-dekker
approved these changes
Mar 26, 2026
caseydavenport
added a commit
to caseydavenport/operator
that referenced
this pull request
Mar 26, 2026
caseydavenport
added a commit
that referenced
this pull request
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wire up the operator to read DatastoreMigration CRs and react to migration phase changes:
Migratingphase to avoid fighting over the APIService resourceConvergedphase to switch to v3 CRD modecalico-kube-controllers-migrationClusterRole) based on whether a DatastoreMigration CR existsUseV3CRDS()signature to accept*rest.Configso it can create a dynamic client for the DatastoreMigration checkStacked on #4576 -- merge that first.